<?php
namespace app\home\controller;
use app\home\model\ActivityModel;
use think\Controller;
use think\Db;

class Activity extends Controller
{
    /**
     * 活动首页
     */
    public function index(){
        $activityList = new ActivityModel();
        $activityList = $activityList->activityList();
        $this->assign('list', $activityList);
        return $this->fetch('index');
    }

    /**
     * 活动参与人数增加
     */
    public function addNum(){
        $id = input('id');
        $addFind = new ActivityModel();
        $addFind = $addFind->getAddFind($id);
        $data = [
            'active_num' => $addFind['active_num']+1
        ];
        $addNum = new ActivityModel();
        $addNum = $addNum->getAddNum($id, $data);
        return $addNum;
    }

}